package com.imooc.modular.filter;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
import java.util.Date;


/**
 * 自定义Filter 过滤器
 *
 * @author yuelinbo
 * @date 2019/2/10 10:42
 **/
//
public class TimeFilter /*implements Filter*/ {
    /*@Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("my TimeFiler init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("my TimeFilter start");
        long start = new Date().getTime();
        filterChain.doFilter(servletRequest, servletResponse);
        long end = new Date().getTime();
        System.out.println("time filter :" + (start - end));
        System.out.println("my TimeFilter finish");

    }

    @Override
    public void destroy() {
        System.out.println("my TimeFiler destroy");

    }*/
}
